package zhishu.iceyyy.com.bxq_2500.adapter;

import android.content.Context;
import android.graphics.Bitmap;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.squareup.picasso.Picasso;

import zhishu.iceyyy.com.bxq_2500.R;
import zhishu.iceyyy.com.bxq_2500.base.BaseApplication;
import zhishu.iceyyy.com.bxq_2500.base.Base_Z_Adapter;
import zhishu.iceyyy.com.bxq_2500.bean.Serach;
import zhishu.iceyyy.com.bxq_2500.utils.BitmapTrans;


/**
 * Created by 他的猫 on 2016/11/21.
 * 处置场 未接单
 */

public class Soucang_Adapter extends Base_Z_Adapter {



    Context context;
    BitmapTrans bitmapTrans;

    public Soucang_Adapter(Context context ) {
        this.context = context;
        bitmapTrans = new BitmapTrans();

    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        Soucang_Adapter.Holder holder = null;
        // 查找控件
        if (null == convertView) {
            convertView = LayoutInflater.from(BaseApplication.getInstance())
                    .inflate(R.layout.activity_sousuo_, null);
            holder = new Soucang_Adapter.Holder();

            holder.tv_name = (TextView) convertView
                    .findViewById(R.id.tv_name);
            holder.iv_girl = (ImageView) convertView
                    .findViewById(R.id.iv_girl);

            holder.tv_nianfen = (TextView) convertView
                    .findViewById(R.id.tv_nianfen);
            holder.tv_diqu
                    = (TextView) convertView
                    .findViewById(R.id.tv_diqu);
            holder.tv_gengxinshijian = (TextView) convertView
                    .findViewById(R.id.tv_gengxinshijian);
            holder.tv_pingfen = (TextView) convertView
                    .findViewById(R.id.tv_pingfen);
            holder.tv_daoyan = (TextView) convertView
                    .findViewById(R.id.tv_daoyan);
            holder.tv_zhuyan = (TextView) convertView
                    .findViewById(R.id.tv_zhuyan);

            holder.tv_bieming = (TextView) convertView
                    .findViewById(R.id.tv_bieming);
            holder.tv_tishi = (TextView) convertView
                    .findViewById(R.id.tv_tishi);
            // 缓存Holder
            convertView.setTag(holder);
        } else {
            holder = (Soucang_Adapter.Holder) convertView.getTag();
        }
        final Serach.DataBean.MovicesBean analog = (Serach.DataBean.MovicesBean) getItem(position);
        holder.tv_name.setText("" + analog.getVod_name());
        holder.tv_nianfen.setText("上映年份:" + analog.getVod_year());
        holder.tv_diqu.setText("地区:" + analog.getVod_area());
        holder.tv_gengxinshijian.setText("更新:" + analog.getVod_status());
        holder.tv_pingfen.setText("评分:" + analog.getVod_score());
        holder.tv_daoyan.setText("导演:" + analog.getVod_director());
        holder.tv_bieming.setText("别名:" + analog.getVod_tag());
        holder.tv_zhuyan.setText("主演:" + analog.getVod_actor());
        holder.tv_tishi.setText(analog.getVod_remarks());
        Picasso.with(context).load(analog.getVod_pic()).transform(bitmapTrans).config(Bitmap.Config.RGB_565).placeholder(context.getDrawable(R.drawable.bg_holder_brown)).into(holder.iv_girl);
        return convertView;
    }

    public class Holder {

        TextView tv_name, tv_tishi, tv_nianfen, tv_diqu, tv_gengxinshijian, tv_pingfen, tv_daoyan, tv_bieming, tv_zhuyan;
        ImageView iv_girl;

    }


}
